package com.ztf.room.dao;

import com.ztf.room.bean.ActApplyResults;
import com.ztf.room.bean.ActApplys;
import com.ztf.room.bean.Activities;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ActivityDao {
    @Select("select * from act_applys where studentId =#{studentId}")
    List<ActApplys> getActivityList(Integer studentId);

    @Insert(" insert into activities values (null,#{activityContent},#{activityCategory},#{activityAmount},#{activityNote})")
    int addActivity(Activities activities);

    @Insert("insert into act_applys(actApplyId,studentId,studentName,studentAcademy,activityCategory,activityContent,activityAmount,startTime,closeTime,applyReason,applyDate)values(null,#{studentId},#{studentName},#{studentAcademy},#{activityCategory},#{activityContent},#{activityAmount},#{startTime},#{closeTime},#{applyReason},#{applyDate})")
    void addActivityApply(ActApplys actApplys);

    @Select("select * from act_applys where status='3'")
    List<ActApplys> getApplyList();

    @Update("update act_applys set status = #{status} where actApplyId =#{actApplyId}")
    int agreeApplyActivity(ActApplys actApplys);

    @Select("select * from act_applys where actApplyId =#{actApplyId}")
    ActApplys selectApplyActivityById(Integer actApplyId);

    @Insert("insert into act_apply_results values(null,#{actApplyId},#{approveOrnot},#{teacherId},#{teacherName},#{teacherDepart},#{applyresultsDate})")
    void addActivityResult(ActApplyResults applyResults);
}
